﻿$.MGJ.lnventoryStatistics = [];

(function () {
    var _this = $.MGJ.lnventoryStatistics;
    $.extend($.MGJ.lnventoryStatistics, {

        // 显示详细数据
        Dialog_ShowDataObj: null,
        Dialog_ShowData: function (obj) {
            var id = $(obj).attr("ID");
            this.Dialog_OutShowDataObj = $.L.dialog({
                url: ACTION_URL("lnventoryShowData", "FleeGoods") + "?id=" + id,
                title: "详细数据",
                width: 1100,
                height: 'auto',
                buttons: {
                    "button_cancel": {
                        type: 'primary',
                        text: '返回',
                        click: 'MODALMISS'
                    }
                },
            });
        },
    });
})(jQuery);
(function () {
    var _this = $.MGJ.lnventoryStatistics;
    $.extend($.MGJ.lnventoryStatistics, { 
        PageIndex: 1,
        WareHouseId:0,
        //查询信息
        Ajax_GetInfo: function (pageIndex) {
            PageIndex = pageIndex || 1;
            var SearchKey = $("#Ssearch").val();
            $.L.ajaxHandle({
                url: ACTION_URL("GetStockData", "FleeGoods"),
                data: {
                    warehouseId:WareHouseId,
                    SearchKey: SearchKey,
                    pageIndex: PageIndex,
                    pageSize: 10
                },
                success: function (response) {
                    $("#tableList").L_bindingDataList(response);
                }
            });
        },
        Ajax_GetEntepriseWareHouseList: function () {
            $.L.ajaxHandle({
                url: ACTION_URL("GetWarehouseList", "FleeGoods"),
                success: function (r) {
                    if (r) {
                        for (var item in r) {
                            if (item == 0) {
                                $("#Etype").children().remove();
                                $("#Etype").append("<option value='' selected ='selected' >请选择</option>");
                              //  $("#Etype").append("<option value=" + r[item].Value + " selected ='selected' >" + r[item].Text + "</option>");
                              //  continue;
                            }
                            $("#Etype").append("<option value="+r[item].Value+" >"+r[item].Text+"</option>");
                        }
                       // if (r.length > 0) WareHouseId = r[0].Value;
                       // else WareHouseId =0;
                        WareHouseId = 0;
                        _this.Ajax_GetInfo();
                    }
                }
            })
        },
        DropDownListSelect: function (obj) {
            WareHouseId = obj.value;
            if (WareHouseId == "") {
                return;
            }
            _this.Ajax_GetInfo(1);
        }
    });
})(jQuery);